{% extends 'base.html' %}

{% block title %}
    温度
{% endblock %}

{% set active_page = "temp" %}

{% block content %}
    <div class="span9">
    <p>机房温度：</p>
    <p><a href="/temp/{{ oid }}/20/1/"></a></p>
    <canvas id="myChart" width="700" height="400" data-type="Line" data-list="{{ data_list }}"></canvas>
    <p>现在 --- > (每十秒) -- ></p>
    </div>
{% endblock %}

{% block foot %}
    <script>
        $("canvas").each(function(){
			var $canvas = $(this);
			var ctx = this.getContext("2d");
            var data = {
                labels : ['最新',1,2,3,4,5,6,7,8,'较旧'],
                datasets : [
                    {
                        fillColor : "rgba(151,187,205,0.5)",
                        strokeColor : "rgba(151,187,205,1)",
                        pointColor : "rgba(151,187,205,1)",
                        pointStrokeColor : "#fff",
                        data : $canvas.data('list')
                    }
                ]};
			var evalString = "new Chart(ctx)." + $canvas.data("type") + "(data);";
			eval(evalString);
		});
    </script>

{% endblock %}
